<%@ page language="java" contentType="text/html; charset=UTF-8"    pageEncoding="UTF-8"%> 
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %> 
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<meta http-equiv="Cache-Control" content="public">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="<%=request.getContextPath() %>/css/golden.css" rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath() %>/css/StyleStatic.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="<%=request.getContextPath() %>/js/jquery-1.3.2.min.js"></script>
<title>Insert title here</title>
<script type="text/javascript">

	jQuery.noConflict();
	jQuery(document).ready(function(){
	 
	});
	
	function sendJQuery(data, callback) {
		
		var func = window[callback];
 		jQuery.get("go.abc", data,  	        
	        	func,  	        	
	        	"HTML"); 
    }

    function updateListIndustry(data) {
    		
			var json = JSON.parse(data);
			var list = json.listIndustry;
			var result = "";
			result = "<option value='0'>Chọn Nhóm Ngành</option>";
			for(i=0;i<list.length;i++){
				result += "<option value='"+list[i].industryId+"'>"+list[i].industryName+"</option>";
			}
	        jQuery("#industry").html(result);
	   
    }
    function updateListCompany(data) {
    	
			var json = JSON.parse(data);
			var list = json.listCompany;
			var result = "";
			result = "<option value='0'>Chọn Công ty:</option>";
			for(i=0;i<list.length;i++){
				result += "<option value='"+list[i].companyId+"'>"+list[i].companyName+"</option>";
			}
	        jQuery("#company").html(result);
	       
    }
	function getIndustryList(){
		
		var sectorId = document.getElementById("sector").value;
		
		if(sectorId > 0){
			var action = "action=getListIndustry&sectorId="+sectorId;
			var func = "updateListIndustry";
			sendJQuery(action,func);
		}
		
	}
	function getCompanyList(){
		var industryId = document.getElementById("industry").value;
		if(industryId > 0){
			var action = "action=getListCompany&industryId="+industryId;
			var func = "updateListCompany";
			sendJQuery(action,func);
		}
		
	}
	function isEmail(str)
	{
		if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(str))
		{
			return true;
		}
		else{
	//alert("Invalid E-mail Address! Please re-enter.")
			return false;
		}
	}
	function isDate(str){
		// regular expression to match required date format 
		var re = /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/; 
		if(str != '' && re.test(str) == true) { 
			var regs = str.match(re);
			if(regs[1] < 1 || regs[1] > 31) {			
				return false;
			} 
			if(regs[2] < 1 || regs[2] > 12) {			
				return false;
			} 
			if(regs[3] < 1902 || regs[3] > (new Date()).getFullYear()) {							
				return false;
			}
			return true;
		}else{
			return false;
		}
	}
	function isPhoneNumber(str){
	  	if(str != '' && str.length > 9 && str.length < 13){
	  		for(var j=0; j<str.length; j++)
	  		{
	  		  var temp1 = str.charAt(j);
	  		  var hh = temp1.charCodeAt(0);
	  		  if(hh < 48 || hh > 57)
	  		  {		
	  			return false;
	  		  }		 
	  		}
	  		return true;
	  	}else{
	  		return false;
	  	}	
	}
	function replaceSpecialChar(text){
		var temp = text;
		  var iChars = "!#$%^&*()+=[]\\\';{}|\":<>?";	
		  for (var i = 0; i < text.length; i++) {
			  if (iChars.indexOf(text.charAt(i)) != -1) {
				var c = text.charAt(i)
				var re = "/"+text.charAt(i);
			  	temp = temp.replace(c, re);
			  }
		  }
		  return temp;
	}
	

</script>
</head>
<body>
	<div id = "main_wrapper">
	
		<div>
			<tiles:insertAttribute name="header" />
		</div>
		
		<div>
			<tiles:insertAttribute name="menu" />
		</div>
		
		<div>
			<tiles:insertAttribute name="body" />
		</div>		
		
		<div>
			<tiles:insertAttribute name="footer" />
		</div>
		
	</div>
</body>
</html>